<?php

class Application_Model_FeedData {

    function encodeURI($url) {
        // http://php.net/manual/en/function.rawurlencode.php
        // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURI
        $reserved = array(
            '%2D' => '-', '%5F' => '_', '%2E' => '.', '%21' => '!',
            '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'
        );
        $unescaped = array(
            '%3B' => ';', '%2C' => ',', '%2F' => '/', '%3F' => '?', '%3A' => ':','%7E'=>'~',
            '%40' => '@', '%26' => '&', '%3D' => '=', '%2B' => '+', '%24' => '$'
        );
        $score = array(
            '%23' => '#'
        );
        return strtr(rawurlencode($url), array_merge($reserved, $unescaped, $score));
    }

}

